package inline;

import android.util.Log;

import java.io.File;
import java.io.IOException;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;

public class ZipUtil {
    public static boolean validZipFile(File zipFile) {
        try {
            ZipFile zip = new ZipFile(zipFile);
            try {
                zip.close();
            } catch (IOException e) {
                Log.w("ZipUtil", "Failed to close zip file: " + zipFile.getAbsolutePath());
            }
            return true;
        } catch (ZipException e) {
            Log.w("ZipUtil", "File " + zipFile.getAbsolutePath() + " is not a valid zip file.", e);
        } catch (IOException ioe) {
            Log.w("ZipUtil", "Got an IOException trying to open zip file: " + zipFile.getAbsolutePath(), ioe);
        }
        return false;
    }
}
